<template>
  <div>
    <h1>登录页面</h1>
    <p>用户名 <input type="text" v-model="form.username"></p>
    <p>密码 <input type="text" v-model="form.password"></p>
    <button @click="login">登录</button>
  </div>
</template>

<script>
export default {
  name: "Tlogin",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    login(id){
      this.axios.post('teaLogin/',this.form).then(res=>{
       if(res.data.code==200){
         localStorage.setItem("tuserid",res.data.tid)
         localStorage.setItem("tusername",res.data.tname)
       }
      })
      this.$router.push({"path":'/stu',query:{id:id}})
    }
  }
}
</script>

<style scoped>

</style>
